package com.ruoyi.web.wh.service.impl;

import java.util.List;

import com.ruoyi.framework.utils.DateUtils;
import com.ruoyi.web.wh.domain.WhPutInData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.web.wh.mapper.WhRecordMapper;
import com.ruoyi.web.wh.domain.WhRecord;
import com.ruoyi.web.wh.service.IWhRecordService;

/**
 * 出入库记录Service业务层处理
 *
 * @author ruoyi
 * @date 2025-02-27
 */
@Service
public class WhRecordServiceImpl implements IWhRecordService {
    @Autowired
    private WhRecordMapper whRecordMapper;

    /**
     * 查询出入库记录
     *
     * @param id 出入库记录主键
     * @return 出入库记录
     */
    @Override
    public WhRecord selectWhRecordById(Long id) {
        return whRecordMapper.selectWhRecordById(id);
    }

    /**
     * 查询出入库记录列表
     *
     * @param whRecord 出入库记录
     * @return 出入库记录
     */
    @Override
    public List<WhRecord> selectWhRecordList(WhRecord whRecord) {
        return whRecordMapper.selectWhRecordList(whRecord);
    }

    /**
     * 新增出入库记录
     *
     * @param whRecord 出入库记录
     * @return 结果
     */
    @Override
    public int insertWhRecord(WhRecord whRecord) {
        whRecord.setCreateTime(DateUtils.getNowDate());
        return whRecordMapper.insertWhRecord(whRecord);
    }

    /**
     * 修改出入库记录
     *
     * @param whRecord 出入库记录
     * @return 结果
     */
    @Override
    public int updateWhRecord(WhRecord whRecord) {
        whRecord.setUpdateTime(DateUtils.getNowDate());
        return whRecordMapper.updateWhRecord(whRecord);
    }

    /**
     * 批量删除出入库记录
     *
     * @param ids 需要删除的出入库记录主键
     * @return 结果
     */
    @Override
    public int deleteWhRecordByIds(Long[] ids) {
        return whRecordMapper.deleteWhRecordByIds(ids);
    }

    /**
     * 删除出入库记录信息
     *
     * @param id 出入库记录主键
     * @return 结果
     */
    @Override
    public int deleteWhRecordById(Long id) {
        return whRecordMapper.deleteWhRecordById(id);
    }

    @Override
    public List<WhPutInData> selectWhRecordInRank() {
        return whRecordMapper.selectWhRecordInRank();
    }

    @Override
    public List<WhRecord> selectWhPutInRecordByDay(String time) {
        return whRecordMapper.selectWhPutInRecordByDay(time);
    }

    @Override
    public List<WhRecord> selectWhTakeOutRecordByDay(String time) {
        return whRecordMapper.selectWhTakeOutRecordByDay(time);
    }
}
